using System;
using System.IO;
using System.Net;
using System.Reactive;
using System.Reactive.Concurrency;
using System.Reactive.Linq;

namespace Live.Refresh.Components
{
    public class WebWatcher : Watchable
    {
        private int dataLength = 0;
        private IObservable<EventPattern<DownloadStringCompletedEventArgs>> _observable;
        private WebClient wc;
        public WebWatcher()
        {
            Configurable = new PathConfiguration();
        }
        protected override void Start()
        {
            //if (wc == null)
            //{
            //    wc = new WebClient();
            //}
            //_observable = Observable
            //    .FromEventPattern<
            //        DownloadStringCompletedEventHandler,
            //        DownloadStringCompletedEventArgs>(
            //            h => wc.DownloadStringCompleted += h,
            //            h => wc.DownloadStringCompleted -= h).Subscribe(d =>
            //                {
            //                    //Notify.Refresh(d.EventArgs.Result.ToString());
            //                    //System.Diagnostics.Debug.WriteLine(d.EventArgs.Result.ToString());
            //                });
        }


        public override void OnStop()
        {
            throw new NotImplementedException();
        }

        public override string Name
        {
            get { return "WebWatcher"; }
        }
    }
}